package graph;

import java.util.Arrays;

public class WeightedTGraphTest {
    public static void main(String[] args) {
        WeightedTGraph graph = new WeightedTGraph(7);
        graph.addEdge(1, 4, 1);
        graph.addEdge(1, 2, 2);
        graph.addEdge(2, 4, 3);
        graph.addEdge(2, 5, 10);
        graph.addEdge(3, 1, 4);
        graph.addEdge(3, 6, 5);
        graph.addEdge(4, 3, 2);
        graph.addEdge(4, 6, 8);
        graph.addEdge(4, 7, 4);
        graph.addEdge(4, 5, 7);
        graph.addEdge(5, 7, 6);
        graph.addEdge(7, 6, 1);

        System.out.println("1距离所有顶点的最短距离:\n");
        System.out.println(Arrays.toString(graph.Dijkstra(2)));
        System.out.println("任意顶点间的最短距离:\n");
        System.out.println(Arrays.deepToString(graph.multiSourceShortestPath()));
        System.out.println("边数:" + graph.E());
        System.out.println("临接表:" + graph.toString());
        System.out.println("最小生成树:");
        System.out.println(Arrays.deepToString(graph.MST()));
    }
}